<template>
	<view class="content">
		<view class="reserve-block" v-for="(item,index) in list" :key="item.id">
			<view v-if="item.orderType==1" class="div">
				<image :src="item.ticket.picUrl" class="photo"></image>
				<view class="reserve-item">
					<view class="title">{{item.ticket.ticketName}}</view>
					<view class="time">{{item.useDate}}</view>
				</view>
			</view>
			<view v-if="item.orderType==2" class="div">
				<image :src="item.setMeal.picUrl" class="photo"></image>
				<view class="reserve-item">
					<view class="title">{{item.setMeal.setMealName}}</view>
					<view class="time">{{item.useDate}}</view>
				</view>
			</view>
			<view v-if="item.orderType==3" class="div">
				<image :src="item.room.picUrl" class="photo"></image>
				<view class="reserve-item">
					<view class="title">{{item.room.roomName}}</view>
					<view class="time">{{item.useDate}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getFindAllOrder
	} from '@/api/mine.js';
	export default {
		data() {
			return {
				list: [{
					id: 1,
					title: '酒泉夜光杯',
					time: '2022-09-26'
				}]
			}
		},

		methods: {
			getList() {
				getFindAllOrder().then((res) => {
					if (res.code == 1) {
						console.log(res.data)
						this.list = res.data;
					} else {
						console.log(res)
					}
				}).catch((res) => {
					console.log(res)
				})
			},
		},
		onLoad() {
			this.getList()
		}
	}
</script>

<style lang="scss">
	.content {
		width: 100%;
		padding: 30rpx;

		.reserve-block {

			background: #fff;
			margin-bottom: 30rpx;
			box-shadow: 0 0 10px 0 #efefef;

			.div {
				display: flex;
				flex-direction: row;

				.photo {
					width: 180rpx;
					height: 180rpx;
					border-radius: 10rpx;
					margin: 20rpx;
				}


				.reserve-item {
					display: flex;
					flex-direction: column;

					.title {
						margin-top: 30rpx;
					}

					.time {
						margin-top: 50rpx;
					}
				}


			}
		}
	}
</style>
